package com.jxgyl.fallBack;

import com.jxgyl.api.RemoteTestService;
import com.jxgyl.common.data.R;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @program: middleplatform
 * @description: 服务降级
 * @author: Wanglipeng
 * @create: 2022-02-07 14:03
 **/
@Component
public class RemoteTestFallbackFactory implements FallbackFactory<RemoteTestService> {
    @Override
    public RemoteTestService create(Throwable cause) {
        return new RemoteTestService() {
            @Override
            public R<String> test(String name) {
                return R.fail(null,"远程调用服务失败");
            }
        };
    }
}
